Add preliminary Maven goals to invoke from the pre-commit script#361
Add preliminary Maven goals to invoke from the pre-commit script#361duke1995 wants to merge 1 commit into
Conversation
Make it possible to configure preliminary Maven goals that should be invoked before invoking the main git-code-format:on-pre-commit goal from the pre-commit script. See also: [Cannot use multiple sourceDirectories · Issue Cosium#52 · Cosium/git-code-format-maven-plugin](Cosium#52 (comment))
|
Please add an automated test |
|
Hello @reda-alaoui I have no experience writing a Maven plugin, and therefore no experience writing a proper test for it either. For the PoC, I based my changes on the code that already exists in the project right now, in particular on the code for the I only did a manual test by doing a <properties>
<git-code-format-maven-plugin.version>6.1-SNAPSHOT</git-code-format-maven-plugin.version>
</properties>
<build>
<plugins>
<plugin>
<groupId>com.cosium.code</groupId>
<artifactId>git-code-format-maven-plugin</artifactId>
<version>${git-code-format-maven-plugin.version}</version>
<dependencies>
<!-- Enable https://github.com/google/google-java-format -->
<dependency>
<groupId>com.cosium.code</groupId>
<artifactId>google-java-format</artifactId>
<version>${git-code-format-maven-plugin.version}</version>
</dependency>
</dependencies>
<configuration>
<preliminaryGoals>
<preliminaryGoal>build-helper:add-test-source@add-integration-test-source</preliminaryGoal>
<preliminaryGoal>build-helper:add-test-source@add-acceptance-test-source</preliminaryGoal>
</preliminaryGoals>
<!-- enable hook execution verbose mode -->
<!-- <propertiesToAdd>
<prop>-X</prop>
</propertiesToAdd> -->
</configuration>
</plugin>
</plugins>
</build>With the above config, the contents of the generated pre-commit script is as follows: #!/bin/bash
set -e
"C:/dev/java/maven/default/bin/mvn.cmd" -f "C:/dev/prj/my-group/my-project/pom.xml" build-helper:add-test-source@add-integration-test-source build-helper:add-test-source@add-acceptance-test-source com.cosium.code:git-code-format-maven-plugin:on-pre-commit Kind regards. |
|
@reda-alaoui Is an automated test for this new configuration parameter indispensable for this change to be merged considering that there are no automated tests for the already existing configuration parameters either? |
|
@duke1995 I don't have much time these days to maintain this project. So automated tests for this feature would be of course better since they would partially alleviate the maintaince burden: an automatic test will greatly facilitate the validation of this pull request. |
Make it possible to configure preliminary Maven goals that should be invoked before invoking the main git-code-format:on-pre-commit goal from the pre-commit script.
See also: Cannot use multiple sourceDirectories · Issue #52 · Cosium/git-code-format-maven-plugin